package com.usian.user.controller;

import com.usian.api.user.ApUserRealnameControllerApi;
import com.usian.model.common.dtos.PageResponseResult;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController implements ApUserRealnameControllerApi {
    @Autowired
    private ApUserRealnameService apUserRealnameService;

    @PostMapping("list")
    @Override
    public PageResponseResult ListByStatus(@RequestBody AuthDto authDto) {
        return apUserRealnameService.listByStatus(authDto);
    }

    //认证审核通过
    @PostMapping("/authPass")
    @Override
    public ResponseResult authPass(@RequestBody AuthDto authDto) {
        return apUserRealnameService.updateStatusById(authDto,Short.valueOf("9"));
    }

    //审核失败
    @Override
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto authDto) {
        return apUserRealnameService.updateStatusById(authDto,Short.valueOf("2"));
    }
}
